package com.project.provider;

import java.util.Map;

/**
 * 联系人动态SQL拼接
 */
public class LinkProvider {
    public String findByItemSql(Map map){
        StringBuffer sql = new StringBuffer(
                "select * from t_link where 1=1 ");
        if(map.get("name") != null && map.get("name").toString().length() != 0){
            sql.append("and l_name like '%"+map.get("name")+"%' ");
        }
        if(map.get("startDate") != null){
            sql.append("and l_birthday >= '"+map.get("startDate")+"' ");
        }
        if(map.get("endDate") != null){
            sql.append("and l_birthday <= '"+map.get("endDate")+"' ");
        }

        return sql.toString();
    }
}
